

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>geoslurp.dbfunc package &mdash; geoslurp v1.1.0 documentation</title>
  

  
  
    <link rel="shortcut icon" href="../_static/favicon.ico"/>
  
  
  

  

  
  
    

  

  
  
    <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
  

  

  
        <link rel="index" title="Index"
              href="../genindex.html"/>
        <link rel="search" title="Search" href="../search.html"/>
    <link rel="top" title="geoslurp v1.1.0 documentation" href="../index.html"/>
        <link rel="up" title="geoslurp package" href="geoslurp.html"/>
        <link rel="next" title="geoslurp.discover package" href="geoslurp.discover.html"/>
        <link rel="prev" title="geoslurp.db package" href="geoslurp.db.html"/> 

  
  <script src="../_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav" role="document">

   
  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search">
          

          
            <a href="../index.html" class="icon icon-home"> geoslurp
          

          
          </a>

          
            
            
              <div class="version">
                1.1.0
              </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../introduction.html">An introduction to Geoslurp</a></li>
<li class="toctree-l1"><a class="reference internal" href="../installation.html">Installation of the geoslurp package and setting up the PostgreSQL instance</a></li>
<li class="toctree-l1"><a class="reference internal" href="../confsettings.html">Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../examples.html">Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../reference.html">Reference Documentation</a></li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../index.html">geoslurp</a>
        
      </nav>


      
      <div class="wy-nav-content">
        <div class="rst-content">
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../index.html">Docs</a> &raquo;</li>
        
          <li><a href="../reference.html">Reference Documentation</a> &raquo;</li>
        
          <li><a href="geoslurp.html">geoslurp package</a> &raquo;</li>
        
      <li>geoslurp.dbfunc package</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="../_sources/reference/geoslurp.dbfunc.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  
<style>
/* CSS overrides for sphinx_rtd_theme */

/* 24px margin */
.nbinput.nblast,
.nboutput.nblast {
    margin-bottom: 19px;  /* padding has already 5px */
}

/* ... except between code cells! */
.nblast + .nbinput {
    margin-top: -19px;
}

.admonition > p:before {
    margin-right: 4px;  /* make room for the exclamation icon */
}
</style>
<div class="section" id="module-geoslurp.dbfunc">
<span id="geoslurp-dbfunc-package"></span><h1>geoslurp.dbfunc package<a class="headerlink" href="#module-geoslurp.dbfunc" title="Permalink to this headline">¶</a></h1>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-geoslurp.dbfunc.dbfunc">
<span id="geoslurp-dbfunc-dbfunc-module"></span><h2>geoslurp.dbfunc.dbfunc module<a class="headerlink" href="#module-geoslurp.dbfunc.dbfunc" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="geoslurp.dbfunc.dbfunc.DBFunc">
<em class="property">class </em><code class="descclassname">geoslurp.dbfunc.dbfunc.</code><code class="descname">DBFunc</code><span class="sig-paren">(</span><em>dbcon</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/geoslurp/dbfunc/dbfunc.html#DBFunc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#geoslurp.dbfunc.dbfunc.DBFunc" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">abc.ABC</span></code></p>
<p>Abstract Base class which holds a database functione</p>
<dl class="attribute">
<dt id="geoslurp.dbfunc.dbfunc.DBFunc.db">
<code class="descname">db</code><em class="property"> = None</em><a class="headerlink" href="#geoslurp.dbfunc.dbfunc.DBFunc.db" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="geoslurp.dbfunc.dbfunc.DBFunc.inargs">
<code class="descname">inargs</code><em class="property"> = ''</em><a class="headerlink" href="#geoslurp.dbfunc.dbfunc.DBFunc.inargs" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="geoslurp.dbfunc.dbfunc.DBFunc.info">
<code class="descname">info</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/geoslurp/dbfunc/dbfunc.html#DBFunc.info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#geoslurp.dbfunc.dbfunc.DBFunc.info" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="geoslurp.dbfunc.dbfunc.DBFunc.language">
<code class="descname">language</code><em class="property"> = 'plpgsql'</em><a class="headerlink" href="#geoslurp.dbfunc.dbfunc.DBFunc.language" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="geoslurp.dbfunc.dbfunc.DBFunc.outargs">
<code class="descname">outargs</code><em class="property"> = None</em><a class="headerlink" href="#geoslurp.dbfunc.dbfunc.DBFunc.outargs" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="geoslurp.dbfunc.dbfunc.DBFunc.pgbody">
<code class="descname">pgbody</code><em class="property"> = ''</em><a class="headerlink" href="#geoslurp.dbfunc.dbfunc.DBFunc.pgbody" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="geoslurp.dbfunc.dbfunc.DBFunc.purgeentry">
<code class="descname">purgeentry</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/geoslurp/dbfunc/dbfunc.html#DBFunc.purgeentry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#geoslurp.dbfunc.dbfunc.DBFunc.purgeentry" title="Permalink to this definition">¶</a></dt>
<dd><p>Delete pgfunction entry in the database</p>
</dd></dl>

<dl class="method">
<dt id="geoslurp.dbfunc.dbfunc.DBFunc.register">
<code class="descname">register</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/geoslurp/dbfunc/dbfunc.html#DBFunc.register"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#geoslurp.dbfunc.dbfunc.DBFunc.register" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates/replaces the  pgfunction in the database</p>
</dd></dl>

<dl class="attribute">
<dt id="geoslurp.dbfunc.dbfunc.DBFunc.scheme">
<code class="descname">scheme</code><em class="property"> = 'public'</em><a class="headerlink" href="#geoslurp.dbfunc.dbfunc.DBFunc.scheme" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="geoslurp.dbfunc.dbfunc.DBFunc.updateInvent">
<code class="descname">updateInvent</code><span class="sig-paren">(</span><em>updateTime=True</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/geoslurp/dbfunc/dbfunc.html#DBFunc.updateInvent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#geoslurp.dbfunc.dbfunc.DBFunc.updateInvent" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="geoslurp.dbfunc.dbfunc.DBFunc.updatefreq">
<code class="descname">updatefreq</code><em class="property"> = None</em><a class="headerlink" href="#geoslurp.dbfunc.dbfunc.DBFunc.updatefreq" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="geoslurp.dbfunc.dbfunc.DBFunc.version">
<code class="descname">version</code><em class="property"> = (0, 0, 0)</em><a class="headerlink" href="#geoslurp.dbfunc.dbfunc.DBFunc.version" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

</div>
<div class="section" id="module-geoslurp.dbfunc.radsfuncs">
<span id="geoslurp-dbfunc-radsfuncs-module"></span><h2>geoslurp.dbfunc.radsfuncs module<a class="headerlink" href="#module-geoslurp.dbfunc.radsfuncs" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="geoslurp.dbfunc.radsfuncs.gs_rads_subsegment">
<em class="property">class </em><code class="descclassname">geoslurp.dbfunc.radsfuncs.</code><code class="descname">gs_rads_subsegment</code><span class="sig-paren">(</span><em>dbcon</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/geoslurp/dbfunc/radsfuncs.html#gs_rads_subsegment"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#geoslurp.dbfunc.radsfuncs.gs_rads_subsegment" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#geoslurp.dbfunc.dbfunc.DBFunc" title="geoslurp.dbfunc.dbfunc.DBFunc"><code class="xref py py-class docutils literal notranslate"><span class="pre">geoslurp.dbfunc.dbfunc.DBFunc</span></code></a></p>
<p>Find subsegments in a rads table with the corresponding indices of the datafiles</p>
<dl class="attribute">
<dt id="geoslurp.dbfunc.radsfuncs.gs_rads_subsegment.inargs">
<code class="descname">inargs</code><em class="property"> = 'segments geom, inpoly geom, data jsonb'</em><a class="headerlink" href="#geoslurp.dbfunc.radsfuncs.gs_rads_subsegment.inargs" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="geoslurp.dbfunc.radsfuncs.gs_rads_subsegment.language">
<code class="descname">language</code><em class="property"> = 'sql'</em><a class="headerlink" href="#geoslurp.dbfunc.radsfuncs.gs_rads_subsegment.language" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="geoslurp.dbfunc.radsfuncs.gs_rads_subsegment.outargs">
<code class="descname">outargs</code><em class="property"> = 'TABLE(id int, geom geography(LINESTRING))'</em><a class="headerlink" href="#geoslurp.dbfunc.radsfuncs.gs_rads_subsegment.outargs" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="geoslurp.dbfunc.radsfuncs.gs_rads_subsegment.pgbody">
<code class="descname">pgbody</code><em class="property"> = 'BEGIN\nSELECT 1,ST_DumpPoints(segm) from (SELECT ST_dump(geom) as segm)END;\n'</em><a class="headerlink" href="#geoslurp.dbfunc.radsfuncs.gs_rads_subsegment.pgbody" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="geoslurp.dbfunc.radsfuncs.gs_rads_subsegment.register">
<code class="descname">register</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/geoslurp/dbfunc/radsfuncs.html#gs_rads_subsegment.register"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#geoslurp.dbfunc.radsfuncs.gs_rads_subsegment.register" title="Permalink to this definition">¶</a></dt>
<dd><p>Register/update the function in the database</p>
</dd></dl>

<dl class="attribute">
<dt id="geoslurp.dbfunc.radsfuncs.gs_rads_subsegment.scheme">
<code class="descname">scheme</code><em class="property"> = 'altim'</em><a class="headerlink" href="#geoslurp.dbfunc.radsfuncs.gs_rads_subsegment.scheme" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

</div>
<div class="section" id="module-geoslurp.dbfunc.readfile">
<span id="geoslurp-dbfunc-readfile-module"></span><h2>geoslurp.dbfunc.readfile module<a class="headerlink" href="#module-geoslurp.dbfunc.readfile" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="geoslurp.dbfunc.readfile.readfile">
<em class="property">class </em><code class="descclassname">geoslurp.dbfunc.readfile.</code><code class="descname">readfile</code><span class="sig-paren">(</span><em>dbcon</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/geoslurp/dbfunc/readfile.html#readfile"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#geoslurp.dbfunc.readfile.readfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#geoslurp.dbfunc.dbfunc.DBFunc" title="geoslurp.dbfunc.dbfunc.DBFunc"><code class="xref py py-class docutils literal notranslate"><span class="pre">geoslurp.dbfunc.dbfunc.DBFunc</span></code></a></p>
<p>Registers a plpython function which can read a file from the server and return a bytestring</p>
<dl class="attribute">
<dt id="geoslurp.dbfunc.readfile.readfile.inargs">
<code class="descname">inargs</code><em class="property"> = 'uri text'</em><a class="headerlink" href="#geoslurp.dbfunc.readfile.readfile.inargs" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="geoslurp.dbfunc.readfile.readfile.language">
<code class="descname">language</code><em class="property"> = 'plpython3u'</em><a class="headerlink" href="#geoslurp.dbfunc.readfile.readfile.language" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="geoslurp.dbfunc.readfile.readfile.outargs">
<code class="descname">outargs</code><em class="property"> = 'bytea'</em><a class="headerlink" href="#geoslurp.dbfunc.readfile.readfile.outargs" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="geoslurp.dbfunc.readfile.readfile.pgbody">
<code class="descname">pgbody</code><em class="property"> = 'import os\nimport re\nrlpath=os.path.realpath(uri)\nallowedp=plpy.execute(&quot;select jsonb_array_elements_text(data-&gt;\'allowedpaths\') as apath from admin.inventory where pgfunc = \'readfile\'&quot;,1)\nfor pth in allowedp[0][&quot;apath&quot;]:\n   plpy.info(pth+ &quot; &quot;+uri)\n   if re.search(&quot;^&quot;+pth,rlpath):\n       if os.path.exists(&quot;/geoslurp_data&quot;):\n           mirrmap=plpy.execute(&quot;select conf-&gt;\'MirrorMaps\'-&gt;&gt;\'docker\' as to,conf-&gt;\'MirrorMaps\'-&gt;&gt;\'default\' as from from admin.settings_default&quot;,1)[0]\n           rlpath=rlpath.replace(mirrmap[&quot;from&quot;],mirrmap[&quot;to&quot;])\n       with open(rlpath,\'rb\') as fid:\n           return fid.read()\nraise plpy.Error(&quot;readfile() is not allowed to read files from this path&quot;)'</em><a class="headerlink" href="#geoslurp.dbfunc.readfile.readfile.pgbody" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="geoslurp.dbfunc.readfile.readfile.register">
<code class="descname">register</code><span class="sig-paren">(</span><em>allowedpaths=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/geoslurp/dbfunc/readfile.html#readfile.register"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#geoslurp.dbfunc.readfile.readfile.register" title="Permalink to this definition">¶</a></dt>
<dd><p>Register the readfile function together with allowed paths to read files from
:param allowedpaths:
:type allowedpaths: listlike
:param listlike variable containing paths where this function is allowed to read files from:</p>
</dd></dl>

</dd></dl>

</div>
</div>


           </div>
           <div class="articleComments">
            
           </div>
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="geoslurp.discover.html" class="btn btn-neutral float-right" title="geoslurp.discover package" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="geoslurp.db.html" class="btn btn-neutral" title="geoslurp.db package" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2020, Roelof Rietbroek.

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'../',
            VERSION:'v1.1.0',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE:  true,
            SOURCELINK_SUFFIX: '.txt'
        };
    </script>
      <script type="text/javascript" src="../_static/jquery.js"></script>
      <script type="text/javascript" src="../_static/underscore.js"></script>
      <script type="text/javascript" src="../_static/doctools.js"></script>

  

  
  
    <script type="text/javascript" src="../_static/js/theme.js"></script>
  

  
  
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.StickyNav.enable();
      });
  </script>
   

</body>
</html>